<?php
error_reporting(0);
$con=mysql_connect('127.0.0.1','root','');
mysql_query("set names 'utf8' ");
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_results=utf8");
if (!$con)
{
	 die('Could not connect: ' . mysql_error());
}
mysql_select_db("match",$con);
$row=array();

$res_json=array();

	class sql_query{
		public function query($x){
		$res=array();
		$sql="SELECT ".$x." FROM `data`";
		$result=mysql_query($sql);
		while ($row=mysql_fetch_array($result)) {
        array_push($res,$row[0]);
        //print_r($res);
		}
		return $res;
		}
	}
$e=new sql_query();

$id=$e->query('id');
$lat=$e->query('latitude');
$lng=$e->query('longtitude');
$co=$e->query('co');
$qua=$e->query('qua');
$o3=$e->query('o3');
$dust=$e->query('dust');
$state=$e->query('state');
$time=$e->query('time');
$p[]=sizeof($id);
$res_json=array_merge($p,$id,$lat,$lng,$co,$qua,$o3,$dust,$state,$time);

echo json_encode($res_json,JSON_UNESCAPED_UNICODE);
